package com.ucode.springboot.starter.fileStorage.utils;
import java.util.HashMap;
import java.util.Map;

/**
 * 文件扩展名
 * @author: liliang
 * @date: 2020年1月12日 下午3:12:45
 */
public class FileExtensionConvertConvert {

	private static Map<String,String> mimeType_maps = new HashMap<>();
	
	static{
	    mimeType_maps.put("image/jpeg",".jpg");
	    mimeType_maps.put("image/gif",".gif" );
	    mimeType_maps.put("image/png",".png" );
	    mimeType_maps.put("image/bmp",".bmp" );
	    mimeType_maps.put("text/plain",".txt");
	    mimeType_maps.put("application/zip",".zip" );
	    mimeType_maps.put("application/x-zip-compressed",".zip" );
	    mimeType_maps.put("multipart/x-zip",".zip" );
	    mimeType_maps.put("application/x-compressed",".zip" );
	    mimeType_maps.put("audio/mpeg3",".mp3" );
	    mimeType_maps.put("video/avi",".avi" );
	    mimeType_maps.put("audio/wav",".wav" );
	    mimeType_maps.put("application/x-gzip",".gzip" );
	    mimeType_maps.put("application/x-gzip",".gz");
	    mimeType_maps.put("text/html",".html");
	    mimeType_maps.put("application/x-shockwave-flash",".svg");
	    mimeType_maps.put("application/pdf",".pdf" );
	    mimeType_maps.put("application/msword",".doc" );
	    mimeType_maps.put("application/vnd.openxmlformats-officedocument.wordprocessingml.document",".docx" );
	    mimeType_maps.put("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xlsx" );
	    mimeType_maps.put("application/vnd.ms-excel",".xls" );
	    mimeType_maps.put("application/vnd.ms-powerpoint",".ppt" );
	    mimeType_maps.put("application/vnd.openxmlformats-officedocument.presentationml.presentation",".pptx" );
	}
	
	/**
	 * 媒体资源类型获取文件扩展名
	 * @date 2020年6月10日
	 * @param mimeType 媒体资源类型
	 * @return
	 */
	public static String getFileExtension(String mimeType){
		return mimeType_maps.get(mimeType);
	}
}